import { z } from 'zod'

import { baseManyObjectsScheme, baseSchemeWithNote } from '@/types/base.types'

export const measureSheetStatuses: { [index: number]: string } = {
	0: 'Не согласован',
	1: 'Согласован',
	9: 'Произведен'
}

export const measureSheetScheme = baseSchemeWithNote.extend({
	date: z.coerce.date(),
	address: z.string(),
	status: z.number().min(0).max(9),
	data: z.string(),
	request: z.number(),
	order: z.number().nullable(),
	worker: z.number().nullable()
})

export type IMeasureSheet = z.infer<typeof measureSheetScheme>

export const measureSheetsScheme = baseManyObjectsScheme.extend({
	results: z.array(measureSheetScheme)
})

export type IMeasureSheets = z.infer<typeof measureSheetsScheme>
